package com.yzf.gameeditor.controller;

import com.yzf.gameeditor.service.Rich3Manager;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Controller
@RequestMapping("rich3")
public class GameController {

    @Resource
    private Rich3Manager rich3Manager;

    @GetMapping("")
    public String index() {
        return "rich3";
    }

    @ResponseBody
    @RequestMapping("money")
    public Object rich3Money(@RequestParam(required = false) String money) {
        boolean flag = false;
        if(StringUtils.hasText(money)) {
            flag = rich3Manager.money(money);
        }
        return flag?"修改成功，现金为："+ money:"修改失败";
    }

    @ResponseBody
    @RequestMapping("point")
    public Object rich3Point(@RequestParam(required = false) String point) {
        boolean flag = false;
        if(StringUtils.hasText(point)) {
            flag = rich3Manager.point(point);
        }
        return flag?"修改成功，点卷为："+ point:"修改失败";
    }

}
